﻿<?xml version="1.0" encoding="utf-8" ?>
<!--namespace必须用否者就报错（读取配置文件报：未将对象引用设置到对象的实例）-->
<sqlMap namespace="" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <statements>
    <insert id="Advert.Insert" parameterClass="hashtable">
      INSERT INTO [Advert]
      (
      [Id]
      ,[SpaceId]
      ,[Title]
      ,[Jingle]
      ,[Slug]
      ,[Poster]
      ,[Affix]
      ,[Link]
      ,[StartTime]
      ,[EndTime]
      ,[IsTop]
      ,[LastModifyDateTime]
      ,[LastModifyUserFullName]
      ,[LastModifyUserName]
      ,[CreateDateTime]
      ,[CreateUserFullName]
      ,[CreateUserName]
      )
      VALUES
      (
      #Id#
      ,#SpaceId#
      ,#Title#
      ,#Jingle#
      ,#Slug#
      ,#Poster#
      ,#Affix#
      ,#Link#
      ,#StartTime#
      ,#EndTime#
      ,#IsTop#
      ,#LastModifyDateTime#
      ,#LastModifyUserFullName#
      ,#LastModifyUserName#
      ,#CreateDateTime#
      ,#CreateUserFullName#
      ,#CreateUserName#
      )
    </insert>

    <update id="Advert.Update" parameterClass="hashtable" resultClass="int">
      UPDATE [Advert]
      SET
      [Id] =#Id#
      ,[SpaceId] =#SpaceId#
      ,[Title] =#Title#
      ,[Jingle] =#Jingle#
      ,[Slug] =#Slug#
      ,[Poster] =#Poster#
      ,[Affix] =#Affix#
      ,[Link] =#Link#
      ,[StartTime] =#StartTime#
      ,[EndTime] =#EndTime#
      ,[IsTop] =#IsTop#
      ,[LastModifyDateTime] = #LastModifyDateTime#
      ,[LastModifyUserFullName]=#LastModifyUserFullName#
      ,[LastModifyUserName]=#LastModifyUserName#
      ,[CreateDateTime]=#CreateDateTime#
      ,[CreateUserFullName]=#CreateUserFullName#
      ,[CreateUserName]=#CreateUserName#
      WHERE  [Id] =#Id#
    </update>

    <select id="Advert.Get" parameterClass="string" resultClass="Kaiser.Modules.Cubic.DomainModel.Advert.Advert">
      select
      [Id]
      ,[SpaceId]
      ,[Title]
      ,[Jingle]
      ,[Slug]
      ,[Poster]
      ,[Affix]
      ,[Link]
      ,[StartTime]
      ,[EndTime]
      ,[IsTop]
      ,[LastModifyDateTime]
      ,[LastModifyUserFullName]
      ,[LastModifyUserName]
      ,[CreateDateTime]
      ,[CreateUserFullName]
      ,[CreateUserName]
      from Advert
      where [Id]='$Id$'
    </select>
    <select id="Advert.GetListByCode" parameterClass="string" resultClass="Kaiser.Modules.Cubic.DomainModel.Advert.Advert">
      select
      *
      from Advert
      where [SpaceId]=#value#
    </select>
    <select id="Advert.Search" parameterClass="HashTable" resultClass="Kaiser.Modules.Cubic.DomainModel.Advert.Advert">
      select
      [Id]
      ,[SpaceId]
      ,[Title]
      ,[Jingle]
      ,[Slug]
      ,[Poster]
      ,[Affix]
      ,[Link]
      ,[StartTime]
      ,[EndTime]
      ,[IsTop]
      ,[LastModifyDateTime]
      ,[LastModifyUserFullName]
      ,[LastModifyUserName]
      ,[CreateDateTime]
      ,[CreateUserFullName]
      ,[CreateUserName]
      from Advert
      where [SpaceId]='$SpaceId$'
    </select>

    <delete id="Advert.DeleteList" parameterClass="string" resultClass="int">
      delete from [Advert] where [Id] in
      <iterate  open="(" close=")"  conjunction=",">
        #[]#
      </iterate>
    </delete>

    <select id="Advert.GetListAdvertByCode" parameterClass="string" resultClass="Kaiser.Modules.Cubic.DomainModel.Advert.Advert">
      select * from Advert    where spaceId=#value#
    </select>
  </statements>
</sqlMap>

